package leecode

func longestPalindrome409(s string) (result int) {
	hashMap := make(map[byte]int)
	//统计各个字符出现的次数
	for index, _ := range s {
		hashMap[s[index]]++
	}
	temp := 0
	//偶数次数全要 , 奇数次数只要1个
	for _, value := range hashMap {
		rem := value % 2
		result += value - rem //偶数次数
		if rem == 1 {
			//奇数只去就算一次
			temp = 1
		}
	}
	return result + temp
}
